// 路由配置
import AuthRoute from '@/components/AuthRoute';
import Layout from '@/pages/Layout' //@相当于src/pages/Layout
import Login from '@/pages/Login'
// import Home from '@/pages/Home'
// import Article from '@/pages/Article'
// import Publish from '@/pages/Publish'
import {
  createBrowserRouter,
} from "react-router-dom";
import { lazy, Suspense } from 'react';
const Home = lazy(() => import('@/pages/Home'));
const Article = lazy(() => import('@/pages/Article'));
const Publish = lazy(() => import('@/pages/Publish'));
const router = createBrowserRouter([
  {
    path: "/",
    element: <AuthRoute><Layout /></AuthRoute>,
    children: [
      {
        path: '/',
        element: <Suspense fallback='loading...'><Home/></Suspense>
      },
      {
        path: '/Home',
        element: <Suspense fallback='loading...'><Home/></Suspense>
      },
      {
        path: '/Article',
        element: <Suspense fallback='loading...'><Article/></Suspense>
      },
      {
        path: '/Publish',
        element: <Suspense fallback='loading...'><Publish/></Suspense>
      }
    ]
  },
  {
    path: "/Login",
    element: <Login />,
  },
]);

export default router;